home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / XAMPP 1.4.14 / xampp-win32-1.4.14-installer.exe / xampp / mysql / scripts / make_sharedlib_distribution < prev    next >
Text File  |  2005-04-01  |  2KB  |  120 lines

  1. #!/bin/sh
  2. # The default path should be /usr/local
  3.  
  4. # Get some info from configure
  5. # chmod +x ./scripts/setsomevars
  6.  
  7. machine=i686
  8. system=pc-linux-gnu
  9. version=4.1.11
  10. export machine system version
  11. SOURCE=`pwd` 
  12. CP="cp -p"
  13. MV="mv"
  14.  
  15. STRIP=1
  16. DEBUG=0
  17. SILENT=0
  18. TMP=/tmp
  19. SUFFIX=""
  20.  
  21. parse_arguments() {
  22.   for arg do
  23.     case "$arg" in
  24.       --debug)    DEBUG=1;;
  25.       --tmp=*)    TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
  26.       --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
  27.       --no-strip) STRIP=0 ;;
  28.       --silent)   SILENT=1 ;;
  29.       *)
  30.     echo "Unknown argument '$arg'"
  31.     exit 1
  32.         ;;
  33.     esac
  34.   done
  35. }
  36.  
  37. parse_arguments "$@"
  38.  
  39. BASE=$TMP/my_dist$SUFFIX
  40.  
  41. if [ -d $BASE ] ; then
  42.  rm -r -f $BASE
  43. fi
  44.  
  45. mkdir -p $BASE/lib
  46.  
  47. for i in \
  48.   libmysql/.libs/libmysqlclient.s{l,o}* \
  49.   libmysql/.libs/libmysqlclient*.dylib \
  50.   libmysql_r/.libs/libmysqlclient_r.s{l,o}* \
  51.   libmysql_r/.libs/libmysqlclient_r*.dylib
  52. do
  53.   if [ -f $i ]
  54.   then
  55.     $CP $i $BASE/lib
  56.    fi
  57. done
  58.  
  59. # Change the distribution to a long descriptive name
  60. NEW_NAME=mysql-shared-$version-$system-$machine$SUFFIX
  61. BASE2=$TMP/$NEW_NAME
  62. rm -r -f $BASE2
  63. mv $BASE $BASE2
  64. BASE=$BASE2
  65.  
  66. #if we are debugging, do not do tar/gz
  67. if [ x$DEBUG = x1 ] ; then
  68.  exit
  69. fi
  70.  
  71. # This is needed to prefer GNU tar instead of tar because tar can't
  72. # always handle long filenames
  73.  
  74. PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
  75. which_1 ()
  76. {
  77.   for cmd
  78.   do
  79.     for d in $PATH_DIRS
  80.     do
  81.       for file in $d/$cmd
  82.       do
  83.     if test -x $file -a ! -d $file
  84.     then
  85.       echo $file
  86.       exit 0
  87.     fi
  88.       done
  89.     done
  90.   done
  91.   exit 1
  92. }
  93.  
  94. #
  95. # Create the result tar file
  96. #
  97.  
  98. tar=`which_1 gnutar gtar`
  99. if test "$?" = "1" -o "$tar" = ""
  100. then
  101.   tar=tar
  102. fi
  103.  
  104. echo "Using $tar to create archive"
  105. cd $TMP
  106.  
  107. OPT=cvf
  108. if [ x$SILENT = x1 ] ; then
  109.   OPT=cf
  110. fi
  111.  
  112. $tar $OPT $SOURCE/$NEW_NAME.tar $NEW_NAME
  113. cd $SOURCE
  114. echo "Compressing archive"
  115. gzip -9 $NEW_NAME.tar
  116. echo "Removing temporary directory"
  117. rm -r -f $BASE
  118.  
  119. echo "$NEW_NAME.tar.gz created"
  120.